<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="sl" tagdir="/WEB-INF/tags" %>
<%@page import="com.solution.common.config.PublicConfig"%>
<%
	String basePath = PublicConfig.ROOT_PATH;
	String imgRootURL = PublicConfig.IMG_ROOT_URL;
	String ossImgZoomWX = PublicConfig.OSS_IMG_ZOOM_WX; //微信图片缩放
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>订单详情</title>
<link rel="stylesheet" type="text/css" href="<%=basePath%>/statics_wx/css/style.css">
<script src="<%=basePath%>/statics_wx/js/jquery.min.js"></script>
<script src="<%=basePath%>/statics_wx/js/js.js"></script>
<script type="text/javascript">
	//系统域名 
	var rootPath = '<%=basePath%>';
	// 系统上传文件展示域名
	var imgRootURL = '<%=imgRootURL%>';
</script>
</head>
<body style="background:#f5f5f5">
	<c:set var="rootPath" value="<%=basePath %>"></c:set>
	<c:set var="imgRootURL" value="<%=imgRootURL %>"></c:set>
	<c:set var="ossImgZoomWX" value="<%=ossImgZoomWX %>"></c:set>

	<div class="prd_list1">
		<ul>
			<c:forEach items="${productList }" var="product">
				<li>
		        	<div class="box5">
		            	<div class="good_info11">
		                	<div class="pic">
		                    	<img src="${imgRootURL}/${product.imagePath}${ossImgZoomWX}" />
		                    </div>
		                    <div class="item-info">
		                    	<h2>${product.productName }</h2>
		                        <h3>
		                        	<c:forEach items="${product.productSpecList}" var="spec">
										${spec.specName}：${spec.specValue}&nbsp;&nbsp;
									</c:forEach>
		                        </h3>
		                        <h4>
		                        	<strong>￥<em><sl:nformat num="${product.productItemMoney}" type="2" format="#.00"/></em>
												  <sl:nformat num="${product.productItemMoney}" type="3" format="#.00"/>
		                        	<b>x ${product.buyNum }</b>
		                        </h4>
		                    </div>
		                </div>
		            </div>
		        </li>
			</c:forEach>
	    </ul>
	</div>
	
	<script>
		$(function(){
			$('.prd_list1 .good_info11 .item-info h2').each(function(){
				var productName = $(this).text(); console.log(strlen(productName))
				if (strlen(productName) > 60) {
					$(this).text(productName.substr(0,52) + "...");
				}
			})
			
		})

		function strlen(str) {
			var len = 0;
			for (var i = 0; i < str.length; i++) {
				var c = str.charCodeAt(i);
				//单字节加1 
				if ((c >= 0x0001 && c <= 0x007e)
						|| (0xff60 <= c && c <= 0xff9f)) {
					len++;
				} else {
					len += 2;
				}
			}
			return len;
		}
	</script>
</body>
</html>